<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends BaseAction {
		
	/*初始化*/
	public function _initialize() {
		parent::_initialize();
              
    }	
    public function index(){
		$this->display();
    }
    public function add(){
    //ajaxReturn(数据,'提示信息',状态) 
    	$arr = $_POST;
    	$arr['time'] = time();
    $m=M('message');
    if($m->add($arr)){
      $this->ajaxReturn(0,'留言成功',1);
    }else{
      $this->ajaxReturn(0,'系统错误',0);
    }
  }
  public function adddy(){
    //ajaxReturn(数据,'提示信息',状态) 
    $arr = $_POST;
    $arr['time'] = time();
    $m=M('dingyu');
    $count = $m->where(array('email'=>$arr['email']))->count();//检查邮箱是否已订阅过
    if($count){
      $this->ajaxReturn(0,'此邮箱已经订阅过了',2);     
    }else{
      if($m->add($arr)){
        $this->ajaxReturn(0,'订阅成功',1);
      }else{
        $this->ajaxReturn(0,'系统错误',0);
      }
    }
  }
  
}